package com.prp.gwt.client.widgets.user.article;

import com.google.gwt.user.client.ui.DeckPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class ArticleView extends VerticalPanel{

	private static ArticleView instance;
	public static final int ARTICLE = 0;
	public static final int ADD_RECOMMEND = 1;
	public static final int CREATE_ENTITY = 2;
	public static final int ENTITY = 3;
	public static final int RECOMMEND = 4;
	
	private HorizontalPanel tabBar = new HorizontalPanel();
	private DeckPanel deckPanel = new DeckPanel();
	
	public static ArticleView getInstance(){
		if(instance == null)
			instance = new ArticleView();
		return instance;
	}
	
	private ArticleView(){
		addStyleName("topPanel");
		addTabBar();
		addDeckPanel();
	}
	
	private void addTabBar(){
		tabBar.addStyleName("tabBar");
		HTML empty = new HTML(" ");
		empty.addStyleName("tabBar-text");
		tabBar.add(empty);
		add(tabBar);
	}
	
	private void addDeckPanel(){
		deckPanel.add(ArticleHomeView.getInstance());
		deckPanel.add(ArticleEditPanel.getInstance());
		deckPanel.add(CreateEntityPanel.getInstance());
		deckPanel.add(EntityRecommendPanel.getInstance());
		deckPanel.add(RecommendPanel.getInstance());
		add(deckPanel);
	}
	
	public void showWidget(int index){
		if(index < 0 || index > 5)
			return;
		deckPanel.showWidget(index);
	}
	
}
